﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiDrawableDesc : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiDrawableDesc(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiDrawableDesc obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiDrawableDesc()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiDrawableDesc(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGiDrawableDesc() : this(GlobalsPINVOKE.new_OdGiDrawableDesc(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGiDrawableDesc pParent
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGiDrawableDesc_pParent_get(this.swigCPtr);
				OdGiDrawableDesc result = (intPtr == IntPtr.Zero) ? null : new OdGiDrawableDesc(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiDrawableDesc_pParent_set(this.swigCPtr, OdGiDrawableDesc.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdDbStub persistId
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGiDrawableDesc_persistId_get(this.swigCPtr);
				OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiDrawableDesc_persistId_set(this.swigCPtr, OdDbStub.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdGiDrawable pTransientDrawable
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGiDrawableDesc_pTransientDrawable_get(this.swigCPtr);
				OdGiDrawable result = (intPtr == IntPtr.Zero) ? null : new OdGiDrawable(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiDrawableDesc_pTransientDrawable_set(this.swigCPtr, OdGiDrawable.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public uint nDrawableFlags
		{
			get
			{
				uint result = GlobalsPINVOKE.OdGiDrawableDesc_nDrawableFlags_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiDrawableDesc_nDrawableFlags_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public uint nDrawableDescFlags
		{
			get
			{
				uint result = GlobalsPINVOKE.OdGiDrawableDesc_nDrawableDescFlags_get(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGiDrawableDesc_nDrawableDescFlags_set(this.swigCPtr, value);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public void markToSkip(bool skip)
		{
			GlobalsPINVOKE.OdGiDrawableDesc_markToSkip(this.swigCPtr, skip);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isMarkedToSkip()
		{
			bool result = GlobalsPINVOKE.OdGiDrawableDesc_isMarkedToSkip(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void markBySelection(bool val)
		{
			GlobalsPINVOKE.OdGiDrawableDesc_markBySelection(this.swigCPtr, val);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isMarkedBySelection()
		{
			bool result = GlobalsPINVOKE.OdGiDrawableDesc_isMarkedBySelection(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void markBySubSelection(bool val)
		{
			GlobalsPINVOKE.OdGiDrawableDesc_markBySubSelection(this.swigCPtr, val);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isMarkedBySubSelection()
		{
			bool result = GlobalsPINVOKE.OdGiDrawableDesc_isMarkedBySubSelection(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void markByGeometry(bool val)
		{
			GlobalsPINVOKE.OdGiDrawableDesc_markByGeometry(this.swigCPtr, val);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isMarkedByGeometry()
		{
			bool result = GlobalsPINVOKE.OdGiDrawableDesc_isMarkedByGeometry(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void markBySubGeometry(bool val)
		{
			GlobalsPINVOKE.OdGiDrawableDesc_markBySubGeometry(this.swigCPtr, val);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isMarkedBySubGeometry()
		{
			bool result = GlobalsPINVOKE.OdGiDrawableDesc_isMarkedBySubGeometry(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void markToBreak(bool val)
		{
			GlobalsPINVOKE.OdGiDrawableDesc_markToBreak(this.swigCPtr, val);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isMarkedToBreak()
		{
			bool result = GlobalsPINVOKE.OdGiDrawableDesc_isMarkedToBreak(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void markForForcedSelection(bool val)
		{
			GlobalsPINVOKE.OdGiDrawableDesc_markForForcedSelection(this.swigCPtr, val);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isMarkedForForcedSelection()
		{
			bool result = GlobalsPINVOKE.OdGiDrawableDesc_isMarkedForForcedSelection(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;

		[Flags]
		public enum DrawableDescFlags
		{
			kFirstFlag = 1,
			kMarkedToSkip = 1,
			kMarkedBySelection = 2,
			kMarkedBySubSelection = 4,
			kMarkedByGeometry = 8,
			kMarkedBySubGeometry = 16,
			kMarkedToBreak = 32,
			kMarkedForForcedSelection = 64,
			kLastFlag = 64
		}
	}
}
